-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/predictable server ids #1361
Feature/predictable server ids #1361
Conversation
As opposed to previous similar attempts to achieve this, this PR:
|
e8b9a3e
to
e786f9d
Compare
Preview environmenthttps://shlinkio.github.io/shlink-web-client/feature/predictable-server-ids/ |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1361 +/- ##
===========================================
+ Coverage 79.11% 79.66% +0.54%
===========================================
Files 49 49
Lines 1264 1303 +39
Branches 242 245 +3
===========================================
+ Hits 1000 1038 +38
+ Misses 23 21 -2
- Partials 241 244 +3 ☔ View full report in Codecov by Sentry. |
5e95a7a
to
b31949b
Compare
Closes #1360
Change logic while creating servers, so that the server ID is computed from the name+domain, instead of generating a random UUID.
For example, for
{ "name": "My cool server", domain: "https://example.com", ... }
, the generated ID ismy-cool-server-example.com
.If the ID is duplicated, we will append an auto-increment counter, starting with
1
, until no ID collission happens.This ensures server URLs are predictable across environments, as long as names and domains are preserved. This is the case for environments where a
servers.json
file or env vars for a default server are provided.As a nice side effect, the new URLs are more human friendly, and we can finally get rid of the
uuid
dependency without introducing breaking changes.Existing servers that were previously created with a UUID will continue working normally, as once the ID is generated, there's no special treatment applied to it and it is simply used as is.